﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BAL.Controller;
using EntityObjects;
//using iTextSharp.text;
//using iTextSharp.text.pdf;
using System.IO;

namespace PresentationLayer.View.DepartmentEmployee
{
    public partial class WebForm2 : System.Web.UI.Page
    {
        public static string fstIndex = "0";
        ViewCatalogueForEmployeeControl c;
        protected void Page_Load(object sender, EventArgs e)
        {

            c = new ViewCatalogueForEmployeeControl();
            if (!IsPostBack)
            {
                ddCategory.DataSource = c.getCategory();
                ddCategory.DataTextField = "CategoryName";
                ddCategory.DataValueField = "CategoryId";
                ddCategory.DataBind();
                ViewState[fstIndex] = c.getCatalogue();
                Bind();
            }
        }


        protected void btnSearch_Click1(object sender, EventArgs e)
        {
            int i = Convert.ToInt16(ddCategory.SelectedValue);
            ViewState[fstIndex] = c.searchByCategory(i);
            Bind();
        }

        protected void foo_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            foo.PageIndex = e.NewPageIndex;
            Bind();

        }
        private void Bind()
        {
            foo.DataSource = ViewState[fstIndex];
            foo.DataBind();
        }  

    }
}